//
//  SCMyWishCell.m
//  Mutal
//
//  Created by TonyStart on 16/10/27.
//  Copyright © 2016年 com.wx. All rights reserved.
//

#import "SCMyWishCell.h"
#import "NSString+SCTimeConvert.h"
@interface SCMyWishCell()
@property (weak, nonatomic) IBOutlet UILabel *titLabel;
@property (weak, nonatomic) IBOutlet UILabel *addTimeLabel;
@property (weak, nonatomic) IBOutlet UILabel *replyNumLabel;
@property (weak, nonatomic) IBOutlet UIProgressView *progressView;
@property (weak, nonatomic) IBOutlet UILabel *haveRewardPriceLabel;
@property (weak, nonatomic) IBOutlet UILabel *wishRewardPersonNumLabel;
@property (weak, nonatomic) IBOutlet UILabel *wishRewardTotalLabel;
@property (weak, nonatomic) IBOutlet UILabel *percentageLabel;

@end

@implementation SCMyWishCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
}

-(void)setWishModel:(SCWishModel *)wishModel{
    _wishModel = wishModel;
    if(_wishModel){
        [self setupWishContent];
    }
    
}
-(void)setupWishContent{
    
    self.titLabel.text = self.wishModel.wish_title;
    

    
    self.addTimeLabel.text =  [NSString getShowDateWithTime:self.wishModel.wish_add_time];
    
    self.replyNumLabel.text = self.wishModel.wish_reward_num;
    
    CGFloat haveRewardPrice = round([self.wishModel.wish_reward_price doubleValue]);
    CGFloat totalPrice = [self.wishModel.wish_price doubleValue];
    
    
    CGFloat percentageValue = haveRewardPrice / totalPrice;
    self.progressView.progress = percentageValue;
    
    self.percentageLabel.text = [NSString stringWithFormat:@"%0.0lf%%",percentageValue*100];
    
    self.haveRewardPriceLabel.text =[NSString stringWithFormat:@"已打赏¥%0.0lf",round([self.wishModel.wish_reward_price doubleValue])] ;
    
    self.wishRewardPersonNumLabel.text = [NSString stringWithFormat:@"打赏人数%@",self.wishModel.wish_reward_num];
    
    self.wishRewardTotalLabel.text = [NSString stringWithFormat:@"求打赏%ld",[self.wishModel.wish_price integerValue]];
    
    

}
@end
